import Request from '@/utils/request.js'
let request = new Request().http
let rootPath = "/dept";

function getListByVo(param, pageVo = undefined) {
		if(pageVo	!= undefined){
			return request({
			    url: rootPath + "/getListByVo", //请求头
			    method: "POST", //请求方式
				data: {
					page: pageVo.page,
					size: pageVo.size,
					vo: JSON.stringify(param)
				}
			})
		}else{
			return request({
			    url: rootPath + "/getListByVo", //请求头
			    method: "POST", //请求方式
				data: {
					vo: JSON.stringify(param)
				}
			})
		}
    }
	
function getViewList(pageVo, param) {
        return request({
            url: rootPath + "/getViewList", //请求头
            method: "POST", //请求方式
			data: {
				page: pageVo.page,
				size: pageVo.size,
				vo: JSON.stringify(param)
			}
        })
    }
function getViewAllList(param) {
        return request({
            url: rootPath + "/getViewList", //请求头
            method: "POST", //请求方式
			data: {
				vo: JSON.stringify(param)
			}
        })
    }
function getViewById(id) {
        return request({
            url: rootPath + "/getViewById", //请求头
            method: "GET", //请求方式
			data: {
				id
			}
        })
    }
function getByDept(deptId){
	return request({
	    url: "/dinguser" + "/getByDept", //请求头
	    method: "POST", //请求方式
		data: {
			id: deptId
		}
	})
}
function getByDeptLike(name,deptId){
	return request({
	    url: "/dinguser" + "/getByDept", //请求头
	    method: "POST", //请求方式
		data: {
			id: deptId,
			name: name
		}
	})
}
function updateDept(vo){
	return request({
	    url: rootPath + "/save", //请求头
	    method: "POST", //请求方式
		data: {
			vo: JSON.stringify(vo) 
		}
	})
}
function getSameParkEnterprise(){
	return request({
	    url: rootPath + "/getSameParkEnterprise", //请求头
	    method: "GET", //请求方式
	})
}
// 使用ES模块导出语法
export {
	getListByVo,
	getViewList,
	getViewById,
	getByDept,
	getByDeptLike,
	updateDept,
	getSameParkEnterprise,
	getViewAllList
}